import math

class Vector2(object):
    "for 2d vectors"
    
    def __init__(self, x = 0, y = 0):        
        self.x = x
        self.y = y
        
    def __str__(self):
        return (self.x, self.y)

    def __add__(self, rhs):
        return (self.x + rhs[0], self.y + rhs[1])
        
    def __sub__(self, rhs):
        return (self.x - rhs[0], self.y - rhs[1])
        
    def __neg__(self):
        return (-self.x, -self.y)
       
    def __mul__(self, scalar):
        return (self.x * scalar, self.y * scalar)
        
    def __truediv__(self, scalar):        
        return (self.x / scalar, self.y / scalar)
        
    @staticmethod
    def from_points(P1, P2):
        "will return a vector for two points"
        return Vector2((P2[0] - P1[0]), (P2[1] - P1[1]))
    
    def get_magnitude(self):        
        return math.sqrt( self.x**2 + self.y**2 )
        
    def get_normalize(self):
        "will normalize the magnitude of a vector to 1 unit vector"
        magnitude = self.get_magnitude()
        self.x /= magnitude
        self.y /= magnitude
        return (self.x, self.y)

    def get_angle(P1, P2):
        "supply two points to get angle"
        sideX = P1[0] - P2[0]
        sideY = P1[1] - P2[1]
        angle = math.atan2(sideY, sideX)
        angle = 90 - math.degrees(angle)
        return angle
